package com.sso.utils;

/**
 *
 * @Controller 返回json对象的工具类
 */
public class Result {

	/**
	 * 私有化构造器
	 */
	private Result(){

	}

	private int code;

	private String msg;

	private Object obj;

	public Result(int code, String msg, Object obj) {
		super();
		this.code = code;
		this.msg = msg;
		this.obj = obj;
	}

	public Result(Object obj) {
		super();
		this.obj = obj;
	}

	public static Result buildIsOk(Object obj){
		return new Result(200,"ok",obj);
	}

	public static Result buildIsFail(Object obj){
		return new Result(-1,"fail",obj);
	}

	public static Result build(int code, String msg, Object obj){
		return new Result(code,msg,obj);
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getObj() {
		return obj;
	}

	public void setObj(Object obj) {
		this.obj = obj;
	}

}
